/*
 * @Description:
 * @version:
 * @Author: 尹鹏孝
 * @Date: 2023-07-08 16:19:33
 * @LastEditors: 尹鹏孝
 * @LastEditTime: 2023-10-17 11:07:21
 */
import { Entity, Column, PrimaryGeneratedColumn,DeleteDateColumn, OneToOne, JoinColumn,CreateDateColumn } from 'typeorm';

import { ApiProperty } from '@nestjs/swagger';
import { UserDetail } from './userDetail.entity';
//这一步是将数据放在指定数据表里面Entity("数据表名称")
@Entity('t_sys_user')
export class User {

  @ApiProperty({
    description: 'id', default: null, type: 'number',
    example: 1, required: false,
    // enum: [0, 1],
  })
  @PrimaryGeneratedColumn()
  id: number;
  @ApiProperty({ description: '用户名', default: null })
  @Column()
  username: string;
  @ApiProperty({ description: '经过加密的密码', default: 123456 })
  @Column()
  phone: string;
  @ApiProperty({ description: '手机号', default: null })
  @Column()
  password: string;
  @ApiProperty({ description: '软删除标记', default: false,type:'boolean' })
  @Column({
    nullable: false, default: false
  })
  withDeleted: boolean;
  @ApiProperty({ description: '是否可删除', default: null })
  @DeleteDateColumn({
    nullable: false,
  })
  @CreateDateColumn()
  deletedTime: Date;
  //@OneToOne(type=>User,user=>user)
  @OneToOne(type => UserDetail, userDetail => userDetail.user)
  @JoinColumn()
  userDetail: UserDetail;
}